<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/back.css" />
<script type="text/javascript">
<!--
function selectClass(value){
	if(value==0)
		document.getElementById("bigClass").style.display="none";
	else
		document.getElementById("bigClass").style.display="block";
}
function CheckForm(){	
	if(document.getElementById("className").value == ""){
		alert("类别名称不能为空");
		document.getElementById("className").focus();
		return false;
	}
}
//-->
</script>
<div class="div_class">
	<center>已有商品类别</center><br>
	<table border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc">
		<tr>
			<td>商品品牌</td>
			<td width="150px">商品类别</td>
		</tr>
		<c:forEach items="${biglist}" var="class">
			<tr>
				<td>${class.className}</td>
				<td>
					<select style="width: 100%;">
						<c:forEach items="${list}" var="item">
							<c:if test="${item.parentId == item.classId}">
								<option>${item.itemName}</option>
							</c:if>
						</c:forEach>
					</select>
				</td>
			</tr>
		</c:forEach>
	</table>
</div>
<div class="div_add">
	<center>添加商品类别</center><br>
	<form action="${pageContext.request.contextPath}/ClassServlet?service=addClass" method="post" onsubmit="return CheckForm();">
		<table width="400px" border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc">
			<tr>
				<td>
					<table>
						<tr>
							<td style="padding-left: 40px;">请选择类别：<select name="selectName" style="width:150px" onChange="selectClass(this.value);">
									<option value="0">品牌</option>
									<option value="1">类别</option>
								</select>
							</td>
						</tr>
						<tr>
							<td style="padding-left: 14px;">
								请输入类别名称：<input type="text" id="className" name="className"><span style="color: red;">*</span>
							</td>
						</tr>
						<tr id="bigClass" style="display: none;">
							<td>
								请选择所属大类别：<select name="parentId">
									<c:forEach items="${biglist}" var="class">
										<option value="${class.classId}">${class.className}</option>
									</c:forEach>
								</select>
							</td>
						</tr>
						<tr>
							<td align="center">
								<input type="submit" value="提交">
								<input type="reset" value="重置">
							</td>
						</tr>
					</table>
					</td>
				</tr>
			<tr>
		</table>
	</form>
</div>
